﻿@model FILSTARTUPS_CMS.Models.Post
@{
    ViewBag.Title = "Edit";
}
@section Pagename
{
    <h2>
        Edit Post</h2>
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#validitydate").datepicker({
            altField: "#alternate",
            altFormat: "DD, d MM, yy"
        });
    });

   
</script>
@if (TempData["message"] != null)
{
    <div class="alert-message error span13 left" id="tempdata">
        <center>@TempData["message"]</center>
    </div>
}
@using (Html.BeginForm("Edit", "Post", FormMethod.Post, new { @class = "form-stacked", enctype = "multipart/form-data" }))
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Post</legend>
        @Html.HiddenFor(model => model.postidPK)
        <div class="editor-label">
            @Html.LabelFor(model => model.posttitle)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.posttitle)
            @Html.ValidationMessageFor(model => model.posttitle)
        </div>
        <div class="editor-field">
            Featured Post:<input type="checkbox" name="featuredpost" id="featuredpost" value="on" @(Model.featuredpost == true ? "checked" : "")>
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.postdescription)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.postdescription, new { @class = "ckeditor" })
            @Html.ValidationMessageFor(model => model.postdescription)
        </div>
        <div class="editor-label">
            Category
        </div>
        <div class="editor-field">
            @Html.DropDownList("catidPK")
        </div>
        <div class="editor-label">
            Routing Type
        </div>
        <div class="editor-field">
            @Html.DropDownList("routing")
        </div>
        <div class="editor-label">
            Upload new photo:
            <input type="file" id="postpic" name="postpic" />
            <br />
            <img  width="150" height="150" id="imgpost"  src="@Url.Action("PostPicture", "Post", new { id = Model.postidPK })" alt="@Model.filename" />
        </div>
        <br />
        <p>
            <input type="submit" value="Save" class="ui-button-text" />
        </p>
    </fieldset>
}
<div>
    @Html.ActionLink("Back to List", "Index")
</div>
